package com.jixiantubu.adapter;

import image.SmartImageView;
import java.util.ArrayList;
import java.util.List;
import com.example.jixiantubu.R;
import com.jixiantubu.bean.PostInfoBean;
import com.lidroid.xutils.BitmapUtils;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class Wo_fabutieAdapter extends BaseAdapter {
	Context context;// 上下文
	List<PostInfoBean> list = new ArrayList<PostInfoBean>();// 定义集合Travelsbean
	LayoutInflater mInflater;// 用来绑定布局
	ViewHolder viewHolder;// 初始化控件
	BitmapUtils bitmapUtils;
	ViewHolder mhHolder;
	
	public Wo_fabutieAdapter(Context context, List<PostInfoBean> list) {
		super();
		this.context = context;
		this.list = list;
		// 绑定上下文
				mInflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return list.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return arg0;
	}

	class ViewHolder {
		
		TextView textView1, textView2;
	}
	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		if(arg1==null){
			arg1=mInflater.inflate(R.layout.wo_tiezi_fabu_item_detail, null);
			mhHolder =new ViewHolder();
			
			mhHolder.textView1=(TextView) arg1.findViewById(R.id.wo_fadetie_shijiian);
			mhHolder.textView2=(TextView) arg1.findViewById(R.id.wo_fadetie_biaoti);
			arg1.setTag(mhHolder);
		}else{
			mhHolder = (ViewHolder) arg1.getTag();
		}
		mhHolder.textView1.setText(list.get(arg0).getCreateTime());
		mhHolder.textView2.setText(list.get(arg0).getTitle());
		
		return arg1;
	}

}
